package com.android.dialnowsms;
import android.app.Dialog;

/**
 * Custom Dialog with icon, title, text and progress bar
 *  
 * @author Azim.Zakhidov
 * @TODO: start SMS sending function
 * @TODO: result of SMS send
 * 
 * @TODO: start Phone2Phone calling
 * @TODO: result of Phone2Phone call
 * 
 * @NOTE: http://www.anddev.org/tutorial_modal_dialogs-t4325.html
 * @NOTE: http://developer.android.com/reference/android/app/Dialog.html
 *
 */ 
public class SMSRequestDialog extends Dialog 
{
	/**
	 * Instance of parent/main Activity 
	 */
	//private 
	private SMSComposer composer_view;

	/**
	 * instance of Dialog
	 */
	public Dialog progDialog;

	public SMSRequestDialog(SMSComposer smsComposer)
	{
		composer_view = smsComposer;
	}

	/**
	 * Starts dialog box with provided Title and Text. Uses default software icon
	 *  
	 * @param title of dialog box
	 * @param text to show inside dialog box
	 */
	private void showStartProgress(String title, String text)
	{
		// if does not exist, create new instance with preset
		if ( progDialog == null )
		{
			progDialog = new Dialog( composer_view );
				//.setIcon(R.drawable.sms)
			progDialog.setCancelable( false );
			progDialog.setContentView( R.layout.request_dialog );
		}		
	}
	
	/**
	 * Start dialog box before sending request to server
	 * 
	 * @param phone_number destination phone number
	 */	
	/*public void showSMSSendStart(String phone_number)
	{
		String text = "Sending message to " + phone_number;
		showStartProgress("Sending message...", text);
	}*/

	/**
	 * Shows successful message inside dialog box
	 * 
	 * @param phone_number
	 * @param sms_body
	 */
	/*public void showSMSSend(String phone_number, String sms_body )
	{
		String text = "SMS sent to " + phone_number + "\n" + sms_body;
		showStartProgress("SMS sent", text);
	}*/
	
	/**
	 * Shows error message on SMS/Phone2Phone failing
	 * @param error
	 */
	/*public void showErrorMsg(String error)
	{
		showStartProgress("Error...t", error);		
	}*/
}
